@echo off
::::call  sub_get_index.bat  5

setlocal
title %CURRENT_BOOK_CATEGORY% P%1
if "#%1#"=="##" goto missit

if "#%1#"=="#0000#" goto getPage0

set target_url=http://list.book.dangdang.com/%CURRENT_BOOK_CATEGORY%_P%1.htm

goto:lab1


:getPage0
set target_url=http://list.book.dangdang.com/%CURRENT_BOOK_CATEGORY%.htm


:lab1
set wget_arg=--user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" --cookies=on

if not exist "%CACHE_DIR%\%1.htm" wget -T 60 -t 6 %wget_arg% "%target_url%" -O%CACHE_DIR%\%1.htm

if not exist "%CACHE_DIR%\tmp_p%1.cmd" sleep 1

if not exist "%CACHE_DIR%\tmp_p%1.cmd" getkeystr.exe --i=%CACHE_DIR%\%1.htm --s="http://product.dangdang.com/product.aspx?product_id=" --e="' target=" --k="list_r_list_book" >%CACHE_DIR%\tmp_p%1.cmd

::::sleep 1

call %CACHE_DIR%\tmp_p%1.cmd

::::echo check %CACHE_DIR%\tmp_p%1.cmd

::::pause

goto :eof

:missit
echo miss %1
echo miss %1>>%CACHE_DIR%\miss.txt
pause
goto :eof
:eof